import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
fig = plt.figure()
# ax1 = fig.add_subplot(2, 2, 1)
# ax2 = fig.add_subplot(2, 2, 2)
# ax3 = fig.add_subplot(2, 2, 3)
# ax4 = fig.add_subplot(2, 2, 4)
#
# random_arr = np.random.randn(100)
# plt.plot(random_arr)
# plt.show()
# plt.hist(np.random.randn(100), bins=10, color='b', alpha=0.3)
# plt.show()

# x = np.arange(50)
# y = x + 5 * np.random.rand(50)
# plt.scatter(x, y)
# plt.show()

# x = np.arange(5)
# y1, y2 = np.random.randint(1, 25, size=(2, 5))
# width = 0.25
# ax = plt.subplot(1,1,1)
# ax.bar(x, y1, width, color='r')
# ax.bar(x+width, y2, width, color='g')
# ax.set_xticks(x+width)
# ax.set_xticklabels(['a', 'b', 'c', 'd', 'e'])
# plt.show()


# 矩阵绘图
# m = np.random.rand(10,10)
# print(m)
# plt.imshow(m, interpolation='nearest', cmap=plt.cm.ocean)
# plt.colorbar()
# plt.show()

# fig, subplot_arr = plt.subplots(2,2)
# # bins 为显示个数，一般小于等于数值个数
# subplot_arr[1,0].hist(np.random.randn(100), bins=10, color='b', alpha=0.3)
# plt.show()

# fig, axes = plt.subplots(2)
# axes[0].plot(np.random.randint(0, 100, 50), 'ro--')
# # 等价
# axes[1].plot(np.random.randint(0, 100, 50), color='r', linestyle='dashed', marker='o')
# plt.show()
#
# fig, ax = plt.subplots(1)
# ax.plot(np.random.randn(1000).cumsum(), label='line0')
#
# # 设置刻度
# #plt.xlim([0,500])
# ax.set_xlim([0, 800])
#
# # 设置显示的刻度
# #plt.xticks([0,500])
# ax.set_xticks(range(0,500,100))
#
# # 设置刻度标签
# ax.set_yticklabels(['Jan', 'Feb', 'Mar'])
#
# # 设置坐标轴标签
# ax.set_xlabel('Number')
# ax.set_ylabel('Month')
#
# # 设置标题
# ax.set_title('Example')
#
# # 图例
# ax.plot(np.random.randn(1000).cumsum(), label='line1')
# ax.plot(np.random.randn(1000).cumsum(), label='line2')
# ax.legend()
# ax.legend(loc='best')
# plt.legend()
# plt.show()

x1 = np.random.normal(size=1000)
sns.distplot(x1)

plt.show()